package org.darack_application;

import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class ContactdetailActivity extends Activity {

	final static int ACT_EDIT = 3;
	TextView stdnum;
	TextView stdname;
	TextView stdphone;
	TextView stdmail;
	TextView stdoccup;
	ImageView stdimg;
	ImageView ivout;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_contact_detail);

		stdnum = (TextView) findViewById(R.id.iden);
		stdname = (TextView) findViewById(R.id.name);
		stdphone = (TextView) findViewById(R.id.phonenumber);
		stdmail = (TextView) findViewById(R.id.email);
		stdoccup = (TextView) findViewById(R.id.office);
		stdimg = (ImageView) findViewById(R.id.imgView);

		Intent intent = getIntent();

		stdimg.setImageResource(intent.getIntExtra("imageID",R.drawable.contact_img));
		stdname.setText(intent.getStringExtra("name"));
		stdnum.setText(intent.getStringExtra("iden_num"));
		stdphone.setText(intent.getStringExtra("phone"));
		stdmail.setText(intent.getStringExtra("email"));
		stdoccup.setText(intent.getStringExtra("workarea"));
	}

	public void mOnClick(View v) {
		switch (v.getId()) {
		case R.id.detailok:
			finish();
			break;		
		}
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);

		if (resultCode != RESULT_OK)
			return;

		if (requestCode == ACT_EDIT) {
			stdnum.setText(data.getStringExtra("hackbunOut"));
			stdname.setText(data.getStringExtra("nameOut"));
			stdphone.setText(data.getStringExtra("phoneOut"));
			stdmail.setText(data.getStringExtra("emailOut"));
			stdoccup.setText(data.getStringExtra("officeOut"));

		}
	}
}